package com.tianxin.workbao.workBao.utils.common;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;


public class TimeUtils {
    public static SimpleDateFormat dateFormt = new SimpleDateFormat("yyyy-MM-dd");
    public static SimpleDateFormat datetimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    public static SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");

    public static String getDateFromStamp(long timeStamp) {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        return format.format(new Date(timeStamp));
    }

    public static Date getDateTimeFromStamp(long timeStamp) {
        return new Date(timeStamp);
    }

    public static String getCurrentTime() {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        return format.format(Calendar.getInstance().getTime());
    }

    public static long getCurrentTimeStamp() {
        return System.currentTimeMillis();
    }

    public static String parseTime(String complexTime) {
        return complexTime;
    }

    public static String parseDateTime(Date date) {
        if (date == null)
            return null;
        return datetimeFormat.format(date);
    }

    public static String parseTime(Date date) {
        return timeFormat.format(date);
    }

    public static String parseDate(Date date) {
        return dateFormt.format(date);
    }
}
